package com.xjoyt.pay.master.po;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjoyt.pay.constants.DateConstant;

/**
 * 代理商
 * 
 * @author Administrator
 *
 */
@Entity
@Table(name = "t_distributor")
public class Distributor {

	@Id
	@GeneratedValue(generator = "generator")
	@GenericGenerator(name = "generator", strategy = "assigned")
	@Column(name = "distributor_id", length = 36)
	public String id;

	/**
	 * 代理商号
	 */
	@Column(name = "no", length = 50)
	public String no;

	/**
	 * 密钥
	 */
	@Column(name = "sign_key", length = 50)
	public String key;

	/**
	 * 商户名称
	 */
	@Column(name = "`name`", length = 50)
	public String name;

	/**
	 * 手机号
	 */
	@Column(name = "telephone", length = 50)
	public String telephone;

	/**
	 * 电话
	 */
	@Column(name = "phone", length = 50)
	public String phone;

	/**
	 * 邮箱
	 */
	@Column(name = "email", length = 50)
	public String email;

	/**
	 * 证件类型
	 */
	@Column(name = "id_type")
	public Integer idType;

	/**
	 * 证件号
	 */
	@Column(name = "id_number", length = 50)
	public String idNumber;

	/**
	 * 城市
	 */
	@Column(name = "city", length = 50)
	public String city;

	/**
	 * 省份
	 */
	@Column(name = "province", length = 50)
	public String province;

	/**
	 * 地址
	 */
	@Column(name = "address", length = 50)
	public String address;

	/**
	 * 入住日期
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "added_date")
	@JsonFormat(pattern = DateConstant.DATE_TIME_FORMAT_PATTERN, timezone = "GMT+8")
	public Date addedDate;

	/**
	 * 状态：激活、停用
	 */
	@Column(name = "is_enabled")
	@org.hibernate.annotations.Type(type = "yes_no")
	public Boolean enabled;

	/**
	 * 公司
	 */
	@ManyToOne(targetEntity = Company.class, cascade = {})
	@JoinColumn(name = "company_id", foreignKey = @ForeignKey(name = "none"))
	public Company company;

	/**
	 * 法人代表
	 */
	@Column(name = "legal_person", length = 50)
	public String legalPerson;

	/**
	 * 经营范围
	 */
	@Column(name = "business_operations", length = 255)
	public String businessOperations;

	/**
	 * 上级id
	 */
	@Column(name = "parent_id", length = 36)
	public String parentId;

	/**
	 * 路径
	 */
	@Column(name = "`path`", length = 5000)
	public String path;
}
